import request from "@/utils/request";
import qs from "qs";


export function getNewsList(pageOpts) {
  return request({
    url: `/web/news/?${qs.stringify(pageOpts)}`,
    method: "get"
  });
}

export function addNews(news) {
  return request({
    url: `/web/news/?${qs.stringify(news)}`,
    method: "post"
  });
}

export function updateNews(news) {
  return request({
    url: `/web/news/${news.id}?${qs.stringify(news)}`,
    method: "put"
  });
}

export function updateNewsStatus(ids, enableStatus) {
  return request({
    url: `/web/news/status?${qs.stringify({ ids, enableStatus })}`,
    method: "patch"
  });
}

export function delNews(id) {
  return request({
    url: `/web/news/${id}`,
    method: "delete"
  });
}


export function getNews(id) {
  return request({
    url: `/web/news/${id}`,
    method: "get"
  });
}